﻿/**
 * renpy-player-as3
 * Copyright (C) 2011 Selak.Salam.Salak
 * http://code.google.com/p/renpy-player-as3/
 *	
 * This program is free software. It comes without any warranty, to
 * the extent permitted by applicable law. You can redistribute it
 * and/or modify it under the terms of the Do What The Fuck You Want
 * To Public License, Version 2, as published by Sam Hocevar. See
 * http://sam.zoy.org/wtfpl/COPYING for more details. */
package 
{
	import flash.display.Sprite;
	import flash.display.StageScaleMode;
	import flash.events.Event;
	import flash.utils.getDefinitionByName;
	import org.osflash.thunderbolt.Logger;
	import renpyas3.model.structs.RenpyOptions;
	
	import renpyas3.model.RenpyPlayerModel;
	import renpyas3.view.RenpyPlayer;
	
	[SWF(width = "800", height = "600", backgroundColor = "#000000", frameRate = "30")]
	public class Main extends Sprite 
	{
		private var _renpyModel:RenpyPlayerModel;
		private var _renpyView:RenpyPlayer;
		private var _options:RenpyOptions;
		private var _embeds:Embeds;
		private var _path:String = "game/"
		//private var _path:String = "gameAirPressure/";  // alternative configs 
		//private var _path:String = "gameNinjagrass/";  // alternative configs  
		
		public function Main():void 
		{
			if (stage) init();
			else addEventListener(Event.ADDED_TO_STAGE, init);
		}
		
		private function init(e:Event = null):void 
		{
			removeEventListener(Event.ADDED_TO_STAGE, init);
			
			Logger.includeTime = false;
			Logger.showCaller = false;
			stage.scaleMode = StageScaleMode.SHOW_ALL;

			_embeds = new Embeds();
			_renpyModel = new RenpyPlayerModel(_path,_options,_embeds)
			_renpyView = new RenpyPlayer(_renpyModel, this.stage);
		}

		
	}
}